package algorithms;
import lejos.nxt.Sound;

import java.io.File;

public class PlayTune {

	public static void main(String[] args) throws InterruptedException {
		playTune();
		//HallOfMountainKing();
		
		//TwaalfNulZeven();
		//MwaapMwaap();
		//HallOfMountainKing();
		//FrereJacque();
	}
	
	private static void playTune() throws InterruptedException{
		
	
		for(int i = 0; i<1 ; i++){
			playTone(392,1000/6,100);
			playTone(523,1000/6,100);
			playTone(659,1000/6,100);
			playTone(784,2000/6,100);
			playTone(659,1000/6,100);
			playTone(784,1000,100);
		}
	}
	
	private static void playTone(int freq, int duration, int vol) throws InterruptedException
	{
		Sound.playTone(freq, duration, vol);
		Thread.sleep(duration);
	}
	
	private static void playTone(int freq, int duration) throws InterruptedException
	{
		playTone(freq, duration*20, 100);
	}
		
	private static void MwaapMwaap() throws InterruptedException{
		playTone(98,1);
		playTone(104,1);
		playTone(110,1);
		playTone(117,1);
		playTone(123,1);
		playTone(131,35);
		
		playTone(93,1);
		playTone(98,1);
		playTone(104,1);
		playTone(110,1);
		playTone(117,1);
		playTone(123,35);
		
		playTone(87,1);
		playTone(93,1);
		playTone(98,1);
		playTone(104,1);
		playTone(110,1);
		playTone(117,35);
		
		playTone(82,1);
		playTone(87,1);
		playTone(93,1);
		playTone(98,1);
		playTone(104,1);
		
		playTone(110,150);
		
	}
	
	private static void TwaalfNulZeven() throws InterruptedException{
		
		for(int i=0; i<4; i++){
		playTone(392,12);
		playTone(392,12);
		playTone(349,12);
		playTone(392,24);
		playTone(294,24);
		playTone(294,12);
		playTone(392,12);
		playTone(523,12);
		playTone(493,12);
		playTone(392,60);
		}
	}
	
	private static void FrereJacque() throws InterruptedException
	{
		playTone(523,40);	
		playTone(587,40);	
		playTone(659,40);	
		playTone(523,40);	
		
		Thread.sleep(10);
		
		playTone(523,40);	
		playTone(587,40);	
		playTone(659,40);	
		playTone(523,40);	
		
		Thread.sleep(10);
			
		playTone(659,40);	
		playTone(698,40);	
		playTone(784,80);		
		
		Thread.sleep(10);
		
		playTone(659,40);	
		playTone(698,40);	
		playTone(784,80);		
		
		Thread.sleep(10);
		
		playTone(784,20);	
		playTone(880,20);	
		playTone(784,20);	
		playTone(698,20);	
		playTone(659,40);	
		playTone(523,40);		
		
		Thread.sleep(10);
		
		playTone(784,20);	
		playTone(880,20);	
		playTone(784,20);	
		playTone(698,20);	
		playTone(659,40);	
		playTone(523,40);		
		
		Thread.sleep(10);
		
		playTone(523,40);	
		playTone(392,40);	
		playTone(523,80);		
		
		Thread.sleep(10);
		
		playTone(523,40);	
		playTone(392,40);	
		playTone(523,80);	
		return;
	}
	
	public static void HallOfMountainKing() throws InterruptedException
	{

		playTone(220,12);  
		playTone(247,12);  
		playTone(262,12);  
		playTone(294,12);  
		playTone(330,12);  
		playTone(262,12);  
		playTone(330,24);  
		playTone(311,12);  
		playTone(247,12);  
		playTone(311,24);  
		playTone(294,12);  
		playTone(233,12);  
		playTone(294,24);  
		playTone(220,12);  
		playTone(247,12);  
		playTone(262,12);  
		playTone(294,12);  
		playTone(330,12);  
		playTone(262,12);  
		playTone(330,12);  
		playTone(440,12);  
		playTone(392,12);  
		playTone(330,12);  
		playTone(262,12);  
		playTone(330,12);  
		playTone(392,48);  

//		playTone(220,12);  
//		playTone(247,12);  
//		playTone(262,12);  
//		playTone(294,12);  
//		playTone(330,12);  
//		playTone(262,12);  
//		playTone(330,24);  
//		playTone(311,12);  
//		playTone(247,12);  
//		playTone(311,24);  
//		playTone(294,12);  
//		playTone(233,12);  
//		playTone(294,24);  
//		playTone(220,12);  
//		playTone(247,12);  
//		playTone(262,12);  
//		playTone(294,12);  
//		playTone(330,12);  
//		playTone(262,12);  
//		playTone(330,12);  
//		playTone(440,12);  
//		playTone(392,12);  
//		playTone(330,12);  
//		playTone(262,12);  
//		playTone(330,12);  
//		playTone(392,48);  
//
//		playTone(330,12);  
//		playTone(370,12);  
//		playTone(415,12);  
//		playTone(440,12);  
//		playTone(494,12);  
//		playTone(415,12);  
//		playTone(494,24);  
//		playTone(523,12);  
//		playTone(440,12);  
//		playTone(523,24);  
//		playTone(494,12);  
//		playTone(415,12);  
//		playTone(494,24);  
//		playTone(330,12);  
//		playTone(370,12);  
//		playTone(415,12);  
//		playTone(440,12);  
//		playTone(494,12);  
//		playTone(415,12);  
//		playTone(494,24);  
//		playTone(523,12);  
//		playTone(440,12);  
//		playTone(523,24);  
//		playTone(494,48);  
//	
//		playTone(330,12);  
//		playTone(370,12);  
//		playTone(415,12);  
//		playTone(440,12);  
//		playTone(494,12);  
//		playTone(415,12);  
//		playTone(494,24);  
//		playTone(523,12);  
//		playTone(440,12);  
//		playTone(523,24);  
//		playTone(494,12);  
//		playTone(415,12);  
//		playTone(494,24);  
//		playTone(330,12);  
//		playTone(370,12);  
//		playTone(415,12);  
//		playTone(440,12);  
//		playTone(494,12);  
//		playTone(415,12);  
//		playTone(494,24);  
//		playTone(523,12);  
//		playTone(440,12);  
//		playTone(523,24);  
//		playTone(494,48);  
//
//		playTone(440,8);  
//		playTone(494,8);  
//		playTone(523,8);  
//		playTone(587,8);  
//		playTone(659,8);  
//		playTone(523,8);  
//		playTone(659,24);  
//		playTone(622,8);  
//		playTone(494,8);  
//		playTone(622,24);  
//		playTone(587,8);  
//		playTone(466,8);  
//		playTone(587,24);  
//		playTone(440,8);  
//		playTone(494,8);  
//		playTone(523,8);  
//		playTone(587,8);  
//		playTone(659,8);  
//		playTone(523,8);  
//		playTone(659,8);  
//		playTone(880,8);  
//		playTone(784,8);  
//		playTone(659,8);  
//		playTone(523,8);  
//		playTone(659,8);  
//		playTone(784,48);  
//
//		playTone(440,8);  
//		playTone(494,8);  
//		playTone(523,8);  
//		playTone(587,8);  
//		playTone(659,8);  
//		playTone(523,8);  
//		playTone(659,24);  
//		playTone(622,8);  
//		playTone(494,8);  
//		playTone(622,24);  
//		playTone(587,8);  
//		playTone(466,8);  
//		playTone(587,24);  
//		playTone(440,8);  
//		playTone(494,8);  
//		playTone(523,8);  
//		playTone(587,8);  
//		playTone(659,8);  
//		playTone(523,8);  
//		playTone(659,8);  
//		playTone(880,8);  
//		playTone(831,8);  
//		playTone(659,8);  
//		playTone(831,8);  
//		playTone(988,8);  
//		playTone(880,48); 
		return;
	}
	

	private static void playFile(){
		
	}
}
